package second.little

import scala.util.Random

/**
  * Created by feng on 24/11/2018.
  */

case class SubmitTask(id:String,name:String)
case class HeartBeat(time:Long)
case object CheckTimeOutTask

object CaseDemo4 extends App{

  var array = Array(CheckTimeOutTask,HeartBeat(123),SubmitTask("1","title"))

  array(Random.nextInt(array.length)) match {
    case SubmitTask(id,name) => {
      println(s"$id,$name")
    }
    case HeartBeat(time) =>{
      println(time)
    }
    case CheckTimeOutTask =>{
      println(CheckTimeOutTask)
    }
  }

}
